﻿using System.Data;
using System.Data.SqlClient;
namespace MyWeb.Data
{
	public class tblCOURSEDAL : SqlDataProvider
	{

		#region[tblCOURSE_GetbyAll]
		public DataTable tblCOURSE_GetByAll()
		{
			using (var cmd = new SqlCommand("sp_tblCOURSE_GetByAll", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCOURSE_GetbyId]
		public DataTable tblCOURSE_GetById(string COURSE_ID)
		{
			using (var cmd = new SqlCommand("sp_tblCOURSE_GetById", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@COURSE_ID", COURSE_ID));return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCOURSE_GetbyTop]
		public DataTable tblCOURSE_GetByTop(string Top, string Where, string Order)
		{
			using (var cmd = new SqlCommand("sp_tblCOURSE_GetByTop", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				cmd.Parameters.Add(new SqlParameter("@Top",Top));
				cmd.Parameters.Add(new SqlParameter("@Where",Where));
				cmd.Parameters.Add(new SqlParameter("@Order",Order));
				return GetTable(cmd);
			}
		}
		#endregion
		#region[tblCOURSE_Insert]
		public void tblCOURSE_Insert(tblCOURSEInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblCOURSE_Insert", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@COURSE_ID", Data.COURSE_ID));
				cmd.Parameters.Add(new SqlParameter("@COURSE_CODE", Data.COURSE_CODE));
				cmd.Parameters.Add(new SqlParameter("@COURSE_NAME", Data.COURSE_NAME));
				cmd.Parameters.Add(new SqlParameter("@DESCRIPTION", Data.DESCRIPTION));
				cmd.Parameters.Add(new SqlParameter("@FEE", Data.FEE));
				cmd.Parameters.Add(new SqlParameter("@STATUS", Data.STATUS));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblCOURSE_Update]
		public void tblCOURSE_Update(tblCOURSEInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblCOURSE_Update", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@COURSE_ID", Data.COURSE_ID));
				cmd.Parameters.Add(new SqlParameter("@COURSE_CODE", Data.COURSE_CODE));
				cmd.Parameters.Add(new SqlParameter("@COURSE_NAME", Data.COURSE_NAME));
				cmd.Parameters.Add(new SqlParameter("@DESCRIPTION", Data.DESCRIPTION));
				cmd.Parameters.Add(new SqlParameter("@FEE", Data.FEE));
				cmd.Parameters.Add(new SqlParameter("@STATUS", Data.STATUS));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
		#region[tblCOURSE_Delete]
		public void tblCOURSE_Delete(string COURSE_ID)
		{
			using (var cmd = new SqlCommand("sp_tblCOURSE_Delete", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@COURSE_ID",COURSE_ID));
				ExeCuteNonquery(cmd);
			}
		}
		#endregion
	}
}